package main

import "fmt"

func main() {
	fmt.Println(Sum(1, 3))
	fmt.Println(Sum(1.1, 1.5))
	fmt.Println(InSlice(1, []int{1, 23, 2}))
	fmt.Println(InSlice("ABC", []string{"1", "23", "2"}))
}

func Sum[T int | float64](a, b T) T {
	return a + b
}

func InSlice[T int | int64 | int32 | uint | string | float64 | float32](needle T, haystack []T) bool {
	for _, v := range haystack {
		if needle == v {
			return true
		}
	}
	return false
}
